// pages/student/student.js
var app = getApp();
var ea = require('../../utils/each.js');
var time = require('../../utils/util.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    getpingjiaUrl: app.data.url + 'zhongxue/teacher/getshijuan',
    shuju: {},
    studentTitle: [
      {
        name: "【2019暑】四年级趣味语文入门班",
        headUrl: "/img/6.png",
        subject: "语文|2班|30人",
        monthUrl: "/img/a9cd43f2a057db348ecb0c27ebb3b3b.png",
        month: "6月12日-12月30日",
        tiemUrl: "/img/e3b12549a528bc7113c3073b3a6de99.png",
        tiem: "周日16:30~18:30",
        teacher: "教师：张老师",
        comment: "布置作业"
      },
      {
        name: "【2019暑】四年级趣味语文入门班",
        headUrl: "/img/6.png",
        subject: "语文|2班|30人",
        monthUrl: "/img/a9cd43f2a057db348ecb0c27ebb3b3b.png",
        month: "6月12日-12月30日",
        tiemUrl: "/img/e3b12549a528bc7113c3073b3a6de99.png",
        tiem: "周日16:30~18:30",
        teacher: "教师：张老师",
        comment: "布置作业"
      },
      {
        name: "【2019暑】四年级趣味语文入门班",
        headUrl: "/img/6.png",
        subject: "语文|2班|30人",
        monthUrl: "/img/a9cd43f2a057db348ecb0c27ebb3b3b.png",
        month: "6月12日-12月30日",
        tiemUrl: "/img/e3b12549a528bc7113c3073b3a6de99.png",
        tiem: "周日16:30~18:30",
        teacher: "教师：张老师",
        comment: "布置作业"
      }
    ]
  },
  skip: function (e) {
    console.log(e);
    var id = e.currentTarget.dataset.id;
    var curriculums = e.currentTarget.dataset.curriculums;
    wx.navigateTo({
      url: '/pages/newWork/newWork?id=' + id + '&curriculums=' + curriculums,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    var shuju = that.data.shuju;
    var user = wx.getStorageSync('newuser');
    var token = user.token
    var shenhe = user.shenhe
    wx.request({
      url: that.data.getpingjiaUrl,
      method: 'post',
      data: { token: token, shenhe: shenhe },
      success: function (res) {
        // console.log(res);
        var data = res.data;
        console.log(data)
        if (data.code == 200) {
          var shuju = data.data.data
          console.log(shuju);
          that.setData({ shuju: shuju });
        } else {
          wx.showToast({
            title: '获取失败',
            icon: 'none',
          })
        }
      }

    })

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})